<script setup lang="ts">
import Login from '@/views/login/Index.vue'
import Layout from '@/views/layout/Index.vue'
import { useUserStore } from '@/stores'
import { computed, ref } from 'vue'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import en from 'element-plus/dist/locale/en.mjs'

const language = ref('zh-cn')
const locale = computed(() => language.value === 'zh-cn' ? zhCn : en)

const userStore = useUserStore()

const hasLogin = computed(() => userStore.token)

</script>

<template>
  <el-config-provider :locale="locale">
    <Layout v-if="hasLogin" />
    <Login v-else />
  </el-config-provider>
</template>

<style lang="less" scoped>

</style>
